<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<script type="text/javascript">

function commentBlog(id){
	var cmdContent=$("#textarea_content").val();
	
	var cmdContentTxt=cmdContent;
	cmdContentTxt = cmdContentTxt.replace(/(<.*?>)/ig,'');//英文算半个，中文算一个字长，标签不能算长度
	var $tipBlogCommentLength=$("#tipBlogCommentLength");
	if(cmdContent==""){
		$tipBlogCommentLength.html("<font style='color: red'>请输入评论内容！</font>");
	}
	if(cmdContentTxt.length>200){
		$tipBlogCommentLength.html("<font style='color: red'>评论内容过不能超过200个字符！</font>");
	}
	if(cmdContentTxt.length<200&&cmdContent!="")
		{
		$.ajax({
			type:"POST",
			url:"commentBlog.htm",
			data:{'id':id,'cmdContent':cmdContent},
			success:function(data){
				$("#cmdContent").xheditor(false);
				$("#tipBlogCommentLength").html("");
				$("#byComment").html(data);
				}
				
			});
		}
	
}
function delComment(id)
{
	$.ajax({
		type:"POST",
		url:"delComment.htm",
		data:{'id':id,'identifier':${blog.identifier }},
		success:function(data){
			$("#cmdContent").xheditor(false);
			$("#byComment").html(data);
			}
		});
}
</script>

<div id="byComment">
	<div class="h_newNews_box">

		<input type="hidden" name="identifier" value="${blog.identifier }" />

		<div class="h_logBox">
			<div class="h_logTop">
				<h2>${blog.subject}</h2>
			</div>
			<div class="h_logText" style="margin-top: 50px">
				
				<p>${blog.blogContent.content}</p>
				<div class="clear"></div>
			</div>
		</div>
		<div id="con_newNews_1" class="h_newNews_text" style="display: block;">
			<div class="h_invitefriends_list pt10">
				<ul>

					<c:forEach items="${cList }" var="comment">
						<li><span><fmt:formatDate value="${blog.gmtCreated}"
									pattern="yyyy-MM-dd HH:mm" type="time" timeStyle="full" /> </span> <a
							onclick="seeOtherFamily('${comment.doorplate}')" title="进入他的家"
							href="javascript:void(0);"> <img width="58" height="58"
								alt="头像" src="${comment.familyAvatar }"> </a> <em>${comment.familyNickName
								} </em>
							<p class="h_invitefriends_name">
								<a onclick="seeOtherFamily('${comment.doorplate}')"
									href="javascript:void(0);">${comment.commentUserName} </a>回
								复：${comment.replaceContent}
							</p>
							<div class="h_invitefriends_reply">
								<c:if test="${comment.member==member.identifier }">
									<div class="h_reply_box">
										<a onclick="delComment(${comment.identifier});" href="javascript:void(0);">删
											除</a>
									</div>
								</c:if>
							</div>
							<div class="clear"></div></li>


					</c:forEach>
				</ul>
			</div>
		</div>
		<div class="h_editBox">
		<%@include file="../common/expression.jsp"%>
			<table>
				<tr>
					<td>&nbsp;</td>
					<td><textarea id="textarea_content" name="textarea_content" style="width: 520px;height:61px;"></textarea>
						<div id="tipBlogCommentLength"></div>
					</td>
				</tr>
				<tr>
					<td>
					&nbsp;
						</td>
					<td>
						<div class="h_button fl mr5"
							onclick="commentBlog(${blog.identifier });">
							<strong>评 论</strong>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</div>
	
</div>
